<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
	
	<head>
		<meta http-equiv="Content-Language" content="en-gb" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="description" content="Colour schemes" />
		<title>PDF Graphics .NET documentation - Colour schemes</title>
		<link rel="stylesheet" href="../style/Help.css" type="text/css" />
	
	</head>
	
	<body>
		<div class="navigator">
			<span>
				<strong>PDF Graphics .NET</strong> :: <a href="..\Index.html">Help</a> :: <a href="..\Painting_graphics.html">Painting graphics</a> :: Colour schemes
			</span>
		</div>
		
		<h1>Colour schemes</h1>
							
		<p>
			<ul>
				<li><a href="#Introduction">Introduction to colour schemes</a></li>
				<li><a href="#Rgb">RGB</a></li>
				<li><a href="#Cmyk">CMYK</a></li>
				<li><a href="#UsingColourSchemes">Using colour schemes</a></li>
			</ul>			
		</p>
			
		<h2><a name="Introduction"></a>Introduction to colour schemes</h2>

		<p>
			Colour schemes define methods for representing colour. These methods depend on the viewing target.
			Colours on a computer screen are composed differently from colours on a printed paper.
			The previous sections of this documentation have all used the same colour scheme, RGB.
			The RGB colour scheme is the most natural for computer graphics as it maps directly onto 
			the colours of computer displays. PDF Graphics .NET supports another major scheme for
			use with printed material, CMYK.
		</p>

		<p>
			For most colours, a representation in one scheme can be converted easily to one in another scheme.
			However, this is not always true. Also, advanced effects such as colour gradients are not the
			same across colour schemes.
		</p>
		
		<p>
			Therefore it is important to select the right colour scheme for your graphics.
			If the target PDF document is going to be displayed mostly on computer screens then the RGB
			scheme is best; for printed material, use CMYK.
		</p>
			
		</p>
			
		<h2><a name="Rgb"></a>RGB</h2>
			
		<p>
			RGB stands for red, green, blue. All colours in the RGB scheme are composed of these three primary
			colours, matching the colours that computer screens are made out of. To create a new RGB colour,
			use the <span class="code">RgbColour</span> class:
		</p>
					
		<div class="sampleCode">RgbColour yellow = new RgbColour(255,255,0);

g.FillRectangle(yellow, new Rectangle(10, 10, 200, 50));</div>
			
		<p>
			The colour created in the example is a uniform yellow. It is composed of red and green, which results
			in yellow. The values for the red, green and blue components range from 0 (none) to 255 (full).
		</p>
			
		<p>
			The PDF Graphics .NET library includes a number of standard RGB colours in the static <span class="code">
				RGB</span> class, as well was matching pens and brushes. The above example can be rewritten as:
		</p>

		<div class="sampleCode">g.FillRectangle(Rgb.Yellow, new Rectangle(10, 10, 200, 50));</div>
			
		<h2><a name="Cmyk"></a>CMYK</h2>

		<p>
			Printed material uses ink in three primary colours and black, and this scheme is referred to as
			CMYK after the cyan, magenta, yellow and black (key) ink. Creating a CMYK colour is done through
			the <span class="code">CMYK</span> class. The example below fills a rectangle in a green
			colour:
		</p>

		<div class="sampleCode">CmykColour green = new CmykColour(161, 0, 255, 0);

g.FillRectangle(green, new Rectangle(10, 10, 200, 50));</div>

		<p>Just like the <span class="code">RGB</span> static class, the <span class="code">CMYK</span>
		static class provides access to standard colours, pens and brushes so that the above code can
		be shortened to:

		<div class="sampleCode">g.FillRectangle(Cmyk.Green, new Rectangle(10, 10, 200, 50));</div>
		
		<h2><a name="UsingColourSchemes"></a>Using colour schemes</h2>
		
		<p>
			All graphics operations accept CMYK or RGB colours. Generally, no limits are imposed on the mixing of
			colour schemes so it's possible to fill a rectangle with an RGB colour and outline it using a
			CMYK pen.
		</p>
			
		<p>
			The exception to this is colour gradients. Both colours in a gradient must be of the same colour
			scheme. PDF Graphics .NET will throw an exception otherwise.
		</p>
			
		<h3>Selecting a colour scheme</h3>
		
		<p>
			Selecting the right colour scheme depends on the target display of the PDF document. A document
			that will primarily be viewed on a computer screen should use RGB colours to ensure that all
			colours are rendered faithfully. Documents that are meant to be printed should use the CMYK
			colour scheme.
		</p>
			
		<h3>Images</h3>
		
		<p>
			Bitmap images are composed of colours, and these colours follow a colour scheme. Again, to ensure
			images are rendered faithfully their colour schemes should match that of the target viewer. Images
			created using simple computer tools will likely use the RGB scheme. More advanced imaging packages
			will allow the creation of CMYK images, or the conversion of RGB images to CMYK. Freehand or vector
			drawing packages usually allow CMYK image export.
		</p>
		
		<p>
			<strong>Note:</strong> Again, there is no limitation to mixing colour schemes. A PDF page can contain
			CMYK images as well as RGB images. The primary reason for using a uniform colour scheme across a
			page or document is colour fidelity.
		</p>
		
		<h3><strong>Navigation options:</strong></h3>
		<p><a href="Clipping.html">&lt; Clipping</a> | <a href="../Advanced_use.html">Advanced use &gt;</a>
		
	</body>
	
</html>